using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using oms.Shared.Data;
using oms.Shared.Models;

namespace oms.Modules.System.Models;

/// <summary>
/// 角色信息
/// </summary>
[Comment("角色信息")]
[Index(nameof(Code), IsUnique = true)]
[Index(nameof(RoleName), IsUnique = true)]
public class SysRoleEntity : BaseEntity
{
    /// <summary>
    /// 角色代码
    /// </summary>
    [Column("code", TypeName = "varchar(20)")]
    [Comment("角色代码")]
    public string? Code { get; set; }

    /// <summary>
    /// 角色名称
    /// </summary>
    [Column("role_name", TypeName = "varchar(30)")]
    [Comment("角色名称")]
    public string? RoleName { get; set; }

    /// <summary>
    /// 状态（enable：启用，disable：禁用）
    /// </summary>
    [Column("status", TypeName = "varchar(30)")]
    [Comment("状态（enable：启用，disable：禁用）")]
    [EnumConverter(typeof(GenericEnumConverter<EnableOrDisableStatusEnum>))]
    public EnableOrDisableStatusEnum Status { get; set; } = EnableOrDisableStatusEnum.Disable; // 默认禁用

    /// <summary>
    /// 显示排序，从大到小
    /// </summary>
    [Column("display_order", TypeName = "int")]
    [Comment("显示排序，从大到小")]
    public int? DisplayOrder { get; set; }
}